<?php
require_once __DIR__."/vendor/autoload.php";
require_once "models/Users.php";
use Illuminate\Database\Capsule\Manager as DB;
$database = [
    'driver'    => 'mysql',
    'host'      => '127.0.0.1',
    'port'      => '33066',
    'database'  => 'test',
    'username'  => 'wynn',
    'password'  => 'Asdfg7912',
    'charset'   => 'utf8',
    'collation' => 'utf8_unicode_ci',
    'prefix'    => '',
];
$db = new DB();
// 创建链接
$db->addConnection($database);
// 设置全局静态可访问
$db->setAsGlobal();
// 启动Eloquent
$db->bootEloquent();

// $user = $db::table("users")->get();var_dump($user);
// $user = $db::table("users")->where('user_id','=',2)->get();

$users=\App\models\Users::all();
//$users=Users::all();
var_dump($users);
foreach($users as $user){
    echo $user->user_name;
}
//$users = $db->connection()->select("select * from users");
//foreach($users as $user) {
//var_dump($user->user_name);

//}